<?php


namespace console\controllers;

use Yii;
use yii\console\Controller;

class ClinicController extends Controller
{
    public function actionClinicInit()
    {
        return Yii::$app->services->clinicUserTreatment->runInit();
    }

    public function actionTreatmentBody($start_time = null,$end_time = null)
    {
        set_time_limit(0);

        try {
            $startTime = time();

            $res = Yii::$app->services->clinicTreatmentManage->treatmentPart($start_time,$end_time);

            $endTime = time();
            $diffTime = $endTime - $startTime;

            echo "success".PHP_EOL;
            echo "开始时间: {$startTime}".PHP_EOL;
            echo "结束时间: {$endTime}".PHP_EOL;
            echo "本次耗时: {$diffTime}".PHP_EOL;
        } catch (\Exception $e) {
            echo 'error: '.$e->getMessage().PHP_EOL;
        }
    }
}